//
//  UINavigationController+WFUtils.m
//  WisdomFarm
//
//  Created by sky on 2017/10/29.
//  Copyright © 2017年 sky. All rights reserved.
//

#import "UINavigationController+WFUtils.h"
#import <UIBarButtonItem+BlocksKit.h>

@implementation UINavigationController (WFUtils)

- (UIBarButtonItem *)wf_backItemWithHandle:(void (^)(id))handle {
//    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    btn.frame = CGRectMake(0, 0, 60, 30);
//    [btn setImage:[UIImage imageNamed:@"login_arrow"] forState:UIControlStateNormal];
//    [btn bk_addEventHandler:handle forControlEvents:UIControlEventTouchUpInside];
//    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn];
    UIBarButtonItem *item = [[UIBarButtonItem alloc] bk_initWithImage:[[UIImage imageNamed:@"login_arrow"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain handler:handle];
    [item setTintColor:[UIColor whiteColor]];
    return item;
}

- (UIBarButtonItem *)wf_itemWithTitle:(NSString *)title handle:(void (^)(id))handle {
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn bk_addEventHandler:handle forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn];
    return item;
}

@end
